/* 
GET方法
url: 请求地址
dataType: 接收数据的类型
*/
function getRequest(url, dataType = 'json'){
    return new Promise((resolve, reject) => {
        let request = new XMLHttpRequest();
        request.open('GET', url);
        request.onreadystatechange = () => {
            if (request.readyState == 4){
                const response = {
                    data: request.response
                }
                resolve(response)
            }
        }
        request.responseType = dataType;
        request.send();
    })
}

